using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace MainGame.Menu
{

  
  /// <summary>
  /// This is a game component that implements IUpdateable.
  /// </summary>
  public class Button // : Microsoft.Xna.Framework.DrawableGameComponent
  {

    public Texture2D texture { get; set; }
    public Rectangle bounds;
    public string message { get; set; }
    public SpriteFont spriteFont { get; set; }
    public Color color { get; set; }
    public Color textColor { get; set; }
    //public float depth;

    SpriteBatch spriteBatch;
    
    // --- Constructors ---

    public Button(Game game) // : base(game)
    {
      this.spriteBatch = game.GetContext().SpriteBatch;
    }

    public Button(Game game, string filepath, Rectangle bounds, Color color, string spritePath, string message, Color textColor)
    // : base(game)
    {
      if ((filepath != null) && (filepath.Length != 0))
        this.texture = game.Content.Load<Texture2D>(filepath);
      this.bounds = bounds;
      this.spriteFont = game.Content.Load<SpriteFont>(spritePath);
      this.message = message;      
      this.spriteBatch = game.GetContext().SpriteBatch;
      this.color = color;
      this.textColor = textColor;
      
        
    }

    public Button(Game game, string filepath, Rectangle bounds, string spritePath, string message)
      : this(game, filepath, bounds, Color.White, spritePath, message, Color.Black) { }

    

    /// <summary>
    /// Check if a given point is within the button bounds
    /// </summary>
    /// <param name="tapPosition">The point to check</param>
    /// <returns>True if the point is within the button bounds, false otherwise</returns>
    public bool IsInBounds(Point point)
    {

      if (bounds.Contains(point))
        return true;
      return false;
    }
  }
}
